package com.mtsmda.chapter2;

import com.mtsmda.chapter2.constructorsEx.AnimalC;
import com.mtsmda.chapter2.constructorsEx.ConstructorInvokeEachOther;
import com.mtsmda.chapter2.inheritanceEx.Test1;
import com.mtsmda.chapter2.inheritanceEx.Test2;
import com.mtsmda.chapter2.overridingEx.Animal;
import com.mtsmda.chapter2.overridingEx.GameShape;
import com.mtsmda.chapter2.overridingEx.Horse;
import com.mtsmda.chapter2.overridingEx.PlayerPiece;
import com.mtsmda.chapter2.overridingEx.TilePiece;
import com.mtsmda.chapter2.referenceCastingEx.Dog;
import com.mtsmda.chapter2.returnTypesEx.Alpha;
import com.mtsmda.chapter2.returnTypesEx.Betta;
import com.mtsmda.chapter2.staticEx.Europa;
import com.mtsmda.chapter2.staticEx.Frog;
import com.mtsmda.chapter2.staticEx.Moldova;

public class Run {

	@SuppressWarnings("static-access")
	public static void main(String[] args) {

		// ///
		Test1 test1 = new Test1();
		Test2 test2 = new Test2();
		System.out.println(test1.equals(test2));
		System.out.println(test1 instanceof Test1);
		System.out.println(test1 instanceof Object);
		System.out.println(test1.getClass().getCanonicalName()
				.equals(Object.class.getCanonicalName()));
		System.out.println(test1.getClass().getCanonicalName()
				.equals(Test1.class.getCanonicalName()));

		// ///
		GameShape gameShape = new GameShape();
		gameShapeRun(gameShape);
		PlayerPiece playerPiece = new PlayerPiece();
		gameShapeRun(playerPiece);
		TilePiece tilePiece = new TilePiece();
		gameShapeRun(tilePiece);

		// ///
		System.out.println("*****");
		Animal animal = new Animal();
		Animal horse = new Horse();
		animal.eat();
		/*
		 * try { animal.name(); } catch (Exception e) { // TODO Auto-generated
		 * catch block e.printStackTrace(); }
		 */
		horse.eat();
		/*
		 * try { horse.name(); } catch (Exception e) { // TODO Auto-generated
		 * catch block e.printStackTrace(); }
		 */
		Horse realHorse = new Horse();
		realHorse.name();

		// ///
		System.out.println("*****");
		Run run = new Run();
		run.doStuff(animal);
		run.doStuff(horse);
		run.doStuff(realHorse);

		// ///
		System.out.println("*****");
		com.mtsmda.chapter2.referenceCastingEx.Animal animalA[] = {
				new com.mtsmda.chapter2.referenceCastingEx.Animal(), new Dog(),
				new com.mtsmda.chapter2.referenceCastingEx.Animal() };

		for (com.mtsmda.chapter2.referenceCastingEx.Animal animal2 : animalA) {
			animal2.makeNoise();
			if (animal2 instanceof Dog) {
				Dog dog = (Dog) animal2;
				dog.playDead();
			}
		}

		// ///
		System.out.println("*****");
		com.mtsmda.chapter2.referenceCastingEx.Animal animalCast = new Dog();
		Dog dog = (Dog) animalCast;
		dog.playDead();
		((Dog) animalCast).playDead();

		// ///
		System.out.println("*****");
		Alpha alpha = new Alpha();
		alpha.getLetterGrek();
		System.out.println("_");
		Alpha alphaBetta = new Betta();
		alphaBetta.getLetterGrek();
		System.out.println("_");
		Betta betta = new Betta();
		betta.getLetterGrek();

		// ///
		System.out.println("*****");
		AnimalC animalC = new AnimalC();
		System.out.println(animalC.getAnimalName());
		AnimalC animalC2 = new AnimalC("Jekson");
		System.out.println(animalC2.getAnimalName());

		// ///
		System.out.println("*****");
		ConstructorInvokeEachOther constructorInvokeEachOther = new ConstructorInvokeEachOther();
		constructorInvokeEachOther.doStuff();

		// ///
		System.out.println("*****");
		Frog.getFrogCount();
		new Frog();
		new Frog();
		new Frog();
		new Frog();
		new Frog();
		Frog.getFrogCount();
		
		/////
		System.out.println("*****");
		Europa europa[] = new Europa[]{new Europa(), new Moldova()};
		for(Europa europaL : europa){
			if(europaL instanceof Moldova){
				((Moldova)europaL).getEuropa();
				continue;
			}
			europaL.getEuropa();
		}
		
		Europa.getEuropa();
		Moldova.getEuropa();
		Moldova.getEuropaMoney();
		
		
	}

	private static void gameShapeRun(GameShape gameShape) {
		gameShape.displayShape();
	}

	private void doStuff(Animal animal) {
		System.out.println("Animal");
	}

	private void doStuff(Horse horse) {
		System.out.println("Horse");
	}
	
	private void forEx(){
		int[] d = new int[15];
		for(int i = 0, j = 0; i < d.length / 2 && true; i++, j--){
			
		}
	}

}